const requireContext = require.context('./sources', true, /.*\.js/)

let directives = {}
requireContext.keys().map(key => {
  const name = key.match(/\/(\w+)\.js/)[1]
  directives[name] = requireContext(key).default
})

export default {
  install: app => {
    Object.keys(directives).forEach(key => {
      app.directive(key, directives[key])
    })
  },
}
